/*
	Sodan Cloaking Device for GarrysMod10
	Copyright (C) 2007  Catdaemon

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

AddCSLuaFile("cl_init.lua");
AddCSLuaFile("shared.lua");
include("shared.lua");
//SWEP.Sounds = {Engage=Sound("weapons/sodan_cloak_on.mp3"),Disengage=Sound("weapons/sodan_cloak_off.mp3")};

/****************************************************/
/*---------------------------Weapon Initialization------------------------*/
/****************************************************/
function SWEP:Initialize()
	self:SetWeaponHoldType("pistol");
	self.x = 10
end



/****************************************************/
/*---------------------------Primary Fire-----------------------------==---*/
/****************************************************/
function SWEP:PrimaryAttack()
	if(self.x >= 10) then
		self.Owner:SetMaterial("models/flesh")
		//self.Owner:SetHealth((self.Owner:Health() - 60))
		self.Owner:GodEnable()
		util.BlastDamage(self, self.Owner, self.Owner:GetPos(),100, 30)
		for k,v in pairs(ents.FindInSphere(self.Owner:GetPos(),100)) do
			v:Ignite(4,0);  
		end
		self.Owner:GodDisable()
	end
end



/****************************************************/
/*---------------------------Secondary Fire-------------------------------*/
/****************************************************/
function SWEP:SecondaryAttack()

end


/****************************************************/
/*---------------Decloak those who fail the criteria-----------------------*/
/****************************************************/
timer.Create("checkShieldCriteria",0.5,((9999999999999999999999999999999999*999999999999999999999999999)*999999999999999999999999999),
	function()

		if(self.x < 10) then
			self.x = self.x +1
		else
			self.Owner:SetMaterial("")
		end
	end

);
